package demo2;

public class OuterClass2 {
    public int data1 = 1;
    private int data2 = 2;
    public static final int DATA3 = 3;

    static class InnerClass2 {
        public int data1 = 11111;
        public int data4 = 4;
        private int data5 = 5;
        public static final int data6 = 6;

        public void test() {
            OuterClass2 outerClass2 = new OuterClass2();
            System.out.println("执行了静态代码块的test()......");
            System.out.println(outerClass2.data1);
            System.out.println(outerClass2.data2);
            System.out.println(DATA3);
            System.out.println(data1);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
        }

        public void test2() {
            final int a = 10;
            //局部内部类,在静态内部类的test2()方法中，创建的
            class Inner {
                public int data1 = 1;

                public void func() {
                    System.out.println("func方法执行了..." + a);
                }
            }
            Inner inner=new Inner();
            inner.func();//注意这两行代码别少
        }
    }
}
